/********************************************************************************
* @File name: stepmotor.h
* @Author: Loganx
* @Gitee: https://gitee.com/loganxiang/lgxsmartcar
* @Version: 1.0(2025-10-09)
* @Description: STC32G单片机步进电机驱动
********************************************************************************
* 本软件使用了STC的STC32G官方库
********************************************************************************/
#ifndef _LGX_STEPMOTOR
#define _LGX_STEPMOTOR

#define STEP_MOTOR_STOP			0x00
#define STEP_MOTOR_START		0x01

#define STEP_MOTOR_FORWARD		0x00
#define STEP_MOTOR_REVERSE		0x01

#define STEP_MOTOR_PORT			P1

extern uint8 StepMotorDirection;
extern uint8 StepMotorSpeed;

void StepMotorInit(void);
void StepMotorSetSpeed(uint8 rpm);
void StepMotorForward(void);
void StepMotorReverse(void);
void StepMotorStop(void);

void StepMotorSetAngle(uint16 angle);
void StepMotorAngleCalibrate(void);

void SystickCallbackStepMotor(void);

#endif